<template>
  <view class="content">
    <navigator url="/pages/user/user" open-type="reLaunch">用户</navigator>
    <button @click="show()">显示</button>
    <button @click="hide()">隐藏</button>
    <button @click="stop">停止</button>
    <image class="logo" src="/static/logo.png"></image>
    <view v-for="it in 100" :key="it">{{it}}</view>
  </view>
</template>

<script setup>
  import { onReachBottom, onLoad } from '@dcloudio/uni-app'

  const show = () => {
    uni.showToast({
      title: '加载...',
      icon: 'loading',
      duration: 3000
    })
  }
  const hide = () => {
    uni.hideToast()
  }

  const stop = () => {
    uni.stopPullDownRefresh()
  }

  onLoad(() => {
    uni.setTabBarItem({
      index: 1,
      text: '自定义'
    })
    uni.setTabBarBadge({
      index: 1,
      text: '33'
    })
    uni.showTabBarRedDot({ index: 2 })
  })
  onReachBottom(() => {
    console.log('到底了')
  })

  setTimeout(() => {
    uni.startPullDownRefresh({})
  }, 1000)
</script>

<style>
  .content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .logo {
    height: 200rpx;
    width: 200rpx;
    margin-top: 200rpx;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 50rpx;
  }

  .text-area {
    display: flex;
    justify-content: center;
  }

  .title {
    font-size: 36rpx;
    color: #8f8f94;
  }
</style>